/*
 *   Copyright 2021 zzh
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 */

package com.aduib.boot.common.compiler;

import java.util.regex.Pattern;

/**
 * @description: DateTimePattern
 * @author: zzh
 * @date: 2021/9/3 11:13
 */
public class JavaPattern {

  public static final Pattern PACKAGE_PATTERN =
      Pattern.compile("package\\s+([$_a-zA-Z][$_a-zA-Z0-9\\.]*);");

  public static final Pattern CLASS_PATTERN =
      Pattern.compile("class\\s+([$_a-zA-Z][$_a-zA-Z0-9]*)\\s+");

  public static final Pattern IMPORT_PATTERN = Pattern.compile("import\\s+([\\w\\.\\*]+);\n");

  public static final Pattern EXTENDS_PATTERN =
      Pattern.compile("\\s+extends\\s+([\\w\\.]+)[^\\{]*\\{\n");

  public static final Pattern IMPLEMENTS_PATTERN =
      Pattern.compile("\\s+implements\\s+([\\w\\.]+)\\s*\\{\n");

  public static final Pattern METHODS_PATTERN =
      Pattern.compile("(\n|\\s)(private|public|protected)\\s+");

  public static final Pattern FIELD_PATTERN = Pattern.compile("[^\n]+=[^\n]+;");

  public static final String CLASS_EXTENSION = ".class";

  public static final String JAVA_EXTENSION = ".java";
}
